#include"../server.hpp"
void Onconnected(const PtrConnection& conn)
{
    DEBUG_LOG("NEW CONNECTION");
}
void OnClosed(const PtrConnection& conn)
{
    DEBUG_LOG("Close CONNECTION");
}
void OnMessage(const PtrConnection& conn,Buffer* buf)
{
    DEBUG_LOG("receive:%s",buf->Read_Position());
    buf->MoveReadOffset(buf->ReadAbleSize());
    std::string str("hello world");
    conn->Send(str.c_str(),str.size());
}
int main()
{
    TcpServer _server(8888);
    //_server.EnableInactiveRelease(10);
    _server.SetThreadCount(2);
    _server.SetConnectedCallback(Onconnected);
    _server.SetMessageCallback(OnMessage);
    _server.SetCloseCallback(OnClosed);
    _server.Start();
}